<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreatePayTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('pay', function (Blueprint $table) {
            $table->increments('id');
            $table->integer("userid")->comment("用户ID");
            $table->string("location",20)->comment("支付位置(order和recharge)");
            $table->string("pay_type",32)->default('wechat')->comment("支付方式");
            $table->string("pay_sn",50)->comment("支付单号");
            $table->string("transaction_id",32)->nullable()->comment("微信支付订单号");
            $table->decimal("amount",10,2)->comment("支付金额");
            $table->integer("is_paid")->default(0)->comment("是否支付");
            $table->dateTime("paid_at")->nullable()->comment("支付时间");
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('pay');
    }
}
